<?php
/**
 * @brief join protocol
 *
 * @param post uid User ID
 * @param post upw User Password
 * @param post unick User Nick
 * @return True/False
 * @author con100 <con100@playplus.net>
 * @since 05/04/2013
 * @copyright Copyright (c) 2013, PlayPlus
 **/
include 'include.php';

$user_id = mysql_real_escape_string($_POST['uid']);
$user_pw = mysql_real_escape_string($_POST['upw']);
$nick = mysql_real_escape_string($_POST['unick']);

if($user_id && $user_pw && $nick){
	$refer_code = joinrefercode();
	$time = time();
	$sql = "insert into ebs_member(id,pw,name,timestemp_moon, my_refer) values ('$user_id',PASSWORD('$user_pw'),'$nick','$time','$refer_code')";
	$res = mysql_query($sql);
	$result = array("Result"=>TRUE);
}
else{
	$result = array("Result"=>FALSE);
}
echo json_encode($result);
/*
header('Content-type: text/xml; charset=UTF-8');

$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
$writer->setIndentString('  ');
$writer->startDocument('1.0', 'UTF-8');

$writer->startElement('join');
	$writer->startElement('result');
	$writer->text($result);
	$writer->endElement();
$writer->endElement();

echo($writer->outputMemory());
*/
?>